//
//  Singleton.m
//  DaHaiDouBan
//
//  Created by dllo on 15/10/27.
//  Copyright (c) 2015年 Wang Dahai. All rights reserved.
//

#import "Singleton.h"




@implementation Singleton


+(instancetype)shareSingleton
{
    
    static Singleton *singleton = nil;
    if (singleton == nil) {
        
        
        singleton = [[[Singleton alloc] init] autorelease];
        
    }
    
    return singleton;
    
}

+(void)getDataWithFileName:(NSString *)name block:(AppToolsBlock)block error:(ErrorBlock)error
{
    NSString *filePath = [[NSBundle mainBundle] pathForResource:name ofType:nil];
    NSData *data = [NSData dataWithContentsOfFile:filePath];
    NSError *error2 = nil;
    
    id result = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error2];
    
    if (error2 == nil) {
        
        
        block(result);
        
    }else{
        
        error(error2);
        
    }
    
    

}


@end
